package org.x.casemodule.enums;

public enum MethodEnum {

    //'APP','SMS','EMAIL'
    APP("APP", "APP"),
    SMS("SMS", "短信"),
    EMAIL("EMAIL", "邮件");
    private String code;
    private String name;
    MethodEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static MethodEnum getByCode(String code) {
        for (MethodEnum value : MethodEnum.values()) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }

    public static MethodEnum getByName(String name) {
        for (MethodEnum value : MethodEnum.values()) {
            if (value.getName().equals(name)) {
                return value;
            }
        }
        return null;
    }


}
